package com.dubbo.rpc.common;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 负载均衡策略
 */
public enum LoadBalanceStrategyEnum {

    /**
     * 轮询
     */
    POLLING,

    /**
     * 随机
     */
    RANDOM,

    /**
     * 带权重随机
     */
    WEIGHT_RANDOM

    ;

    public static LoadBalanceStrategyEnum parse(String curLoadBalanceStrategy) {
        if (StringUtils.isBlank(curLoadBalanceStrategy)) {
            return LoadBalanceStrategyEnum.RANDOM;
        }

        return LoadBalanceStrategyEnum.valueOf(curLoadBalanceStrategy);
    }
}
